import createOrderMixin from "./create-order-mixin.js"
import payOrderMixin from "./pay-order-mixin.js"
import checkOrderMixin from "./check-order-mixin.js"

module.exports = {
	mixins: [createOrderMixin, payOrderMixin, checkOrderMixin],
	data() {
		return {
			timer: null,
			orderNo: null, //订单号
		}
	},
	onLoad() {

	},

	methods: {
		startPayment(option) {
			let {
				params,
				success,
				fail,
				complete,
			} = option

			this.orderConfirm({
				params,
				success: () => {
					this.wxPay({
						success: () => {
							this.queryOrderPayStatus({
								success,
								fail,
								complete,
							})
						},
						fail,
						complete,
					})
				},
				fail,
				complete,
			})
		}
	},
}